<?php

namespace App\Http\Requests;


class MatchOrderRequest extends FormRequest
{


    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $rules = ['type'=>'required|in:deposit,withdraw'];

        if($this->type == 'deposit') {
            $rules['deposit_trade_queue_id'] = ['required','array'];
            $rules['withdraw_trade_queue_id'] = ['required'];

        }else {
            $rules['deposit_trade_queue_id'] = ['required'];
            $rules['withdraw_trade_queue_id'] = ['required','array'];

        }
        return $rules;
    }
    public function messages()
    {
        return [
            'type.required'=>['error_code'=>'F002002','message'=>'匹配的类型不能为空！'],
            'type.in'=>['error_code'=>'F002003','message'=>'匹配的类型的类型必须是指定的！'],
            'deposit_trade_queue_id.required'=>['error_code'=>'F002004','message'=>'deposit_trade_queue_id 必须！'],
            'deposit_trade_queue_id.array'=>['error_code'=>'F002004','message'=>'deposit_trade_queue_id 必须是数组！'],
            'withdraw_trade_queue_id.required'=>['error_code'=>'F002004','message'=>'withdraw_trade_queue_id 必须！'],
            'withdraw_trade_queue_id.array'=>['error_code'=>'F002004','message'=>'withdraw_trade_queue_id 必须是数组！'],
        ];
    }
}
